package com.freeLearning.boot.course.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.freeLearning.boot.course.mapper.CourseAuditMapper;
import com.freeLearning.boot.course.model.VO.CourseAuditPageVO;
import com.freeLearning.boot.course.model.entity.CourseAudit;
import com.freeLearning.boot.course.model.entity.CourseInfo;
import com.freeLearning.boot.course.model.query.CourseInfoPageQuery;
import com.freeLearning.boot.course.service.CourseAuditService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class CourseAuditServiceImpl extends ServiceImpl<CourseAuditMapper, CourseAudit> implements CourseAuditService {
    private final CourseAuditMapper courseAuditMapper;
    public IPage<CourseAuditPageVO> pageQuery(CourseInfoPageQuery courseInfoPageQuery) {
        // 参数构建
        int pageNum = courseInfoPageQuery.getPageNum();
        int pageSize = courseInfoPageQuery.getPageSize();
        Page<CourseInfo> page = new Page<>(pageNum, pageSize);
        return this.courseAuditMapper.getPage(page, courseInfoPageQuery);
    }
}
